<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Person{
            #weight;
            constructor( name , age , weight ){
                this.name = name ; 
                this.age = age ; 
                // this.weight = weight ; 
            }
            setWeight( weight ){
                this.#weight = weight;
                console.log(this.#weight);
            }
            #fn(){
                console.log("我是私有方法");
            }
            fn2(){
                this.#fn();
            }
        }
        let zhangsan = new Person("张三",20,"80kg");
        zhangsan.fn2();
        zhangsan.setWeight();
    </script>
</body>
</html>